package com.dankegongyu.lib.http.api;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * 通用的的api接口
 *
 * @author wupuquan
 * @version 1.0
 * @since 2018/6/12 11:06
 */
public interface DKHttpApiService {

    @GET()
    Observable<String> get(@Url String url, @QueryMap Map<String, Object> maps);

    @POST()
    @FormUrlEncoded
    Observable<String> post(@Url String url, @FieldMap Map<String, Object> maps);

    @POST()
    Observable<String> post(@Url String url, @Body Object body);

    @PUT()
    Observable<String> put(@Url String url, @QueryMap Map<String, Object> maps);

    @PUT()
    Observable<String> put(@Url String url, @Body Object body);

    @DELETE()
    Observable<String> delete(@Url String url, @QueryMap Map<String, Object> maps);

    @HTTP(method = "DELETE", hasBody = true)
    Observable<String> delete(@Url String url, @Body Object body);

}
